package com.sptpc.drink.service.Impl;

import com.sptpc.drink.dao.CategoryMapper;
import com.sptpc.drink.pojo.Category;
import com.sptpc.drink.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CategoryServiceImpl implements CategoryService {
  @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public Category querById(Long id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Category> queryName(String name) {
     return  categoryMapper.selectByCategoryByName(name);
    }

    @Override
    public List<Category> queryAll() {
        return categoryMapper.selectAllCategory();
    }

    @Override
    public void insert(Category category) {
       categoryMapper.insertSelective(category);
    }

    @Override
    public void delete(Long id) {
   categoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(Category category) {

    }
}
